<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
      <title>Zwitterionic digressions</title>
        <link>https://digressions.zwit.link/</link>
        <description>Blog of a medchem student into spectroscopy and software and good readings</description>
        <generator>Zola</generator>
        <language>en</language>
        <atom:link href="https://digressions.zwit.link/en/rss.xml" rel="self" type="application/rss+xml"/>
        <lastBuildDate>Wed, 09 Aug 2023 21:40:00 +0200</lastBuildDate>
        <item>
            <title>Getting Started with Hy, the Python Lisp: a Matplotlib example (ep. 2)</title>
            <pubDate>Wed, 09 Aug 2023 21:40:00 +0200</pubDate>
            <link>https://digressions.zwit.link/en/software/getting-started-with-hy-python-lisp-matplotlib-ep-2/</link>
            <guid>https://digressions.zwit.link/en/software/getting-started-with-hy-python-lisp-matplotlib-ep-2/</guid>
            <description>&lt;p&gt;In the previous episode, we briefly saw what Hy is, what it means that it is a dialect of Lisp, how to install it, and step by step, we wrote a small example to create a line plot in matplotlib, strictly following the imperative approach we would have used in Python.&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>Fragmented peaks of desire</title>
            <pubDate>Tue, 08 Aug 2023 00:00:00 +0000</pubDate>
            <link>https://digressions.zwit.link/en/fragmented-peaks-of-desire/</link>
            <guid>https://digressions.zwit.link/en/fragmented-peaks-of-desire/</guid>
            <description>&lt;p&gt;Throughout my existence, I have always considered myself to be a cautious person. Let&#x27;s even say &amp;quot;a very cautious person.&amp;quot; Yet, in recent years, a series of events has revealed the fragility of my initial belief.&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>Getting Started with Hy, the Python Lisp: a Matplotlib example (ep. 1)</title>
            <pubDate>Mon, 07 Aug 2023 09:26:00 +0200</pubDate>
            <link>https://digressions.zwit.link/en/software/getting-started-with-hy-python-lisp-matplotlib-ep-1/</link>
            <guid>https://digressions.zwit.link/en/software/getting-started-with-hy-python-lisp-matplotlib-ep-1/</guid>
            <description>&lt;p&gt;Hy is a Lisp dialect that combines the expressive power of Lisp with the convenience and extensive libraries of Python.&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>Navigating the perils and finding cozy shelters on a Windows Machine</title>
            <pubDate>Sat, 27 May 2023 11:06:00 +0200</pubDate>
            <link>https://digressions.zwit.link/en/2023/perils-shelters-on-windows-machine/</link>
            <guid>https://digressions.zwit.link/en/2023/perils-shelters-on-windows-machine/</guid>
            <description>&lt;p&gt;In the end, the company PC has arrived. Company PC, in this case, means a Windows machine. Although it was a fresh installation, it seemed already plagued with problems: the bloatware and ads were overwhelming, so I disabled them. Windows Update failed, displaying a cryptic error code, and official Microsoft sites referred me to unofficial sites with ads, recommending obscure batch scripts of unknown functions.&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>Scribbling pixels with Aseprite</title>
            <pubDate>Sat, 13 May 2023 01:35:00 +0200</pubDate>
            <link>https://digressions.zwit.link/en/2023/scribbling-pixels-with-aseprite/</link>
            <guid>https://digressions.zwit.link/en/2023/scribbling-pixels-with-aseprite/</guid>
            <description>&lt;p&gt;I have been fascinated by pixel art since I can remember.
For years, I&#x27;ve been having fun experimenting with pixel art programs, and I fell in love with dithering when I started messing with my blog generator code.
More generally, I have always loved visual art, but lacking what I thought were the necessary artistic skills for traditional painting methods, I never thought I could personally make it.
Yet, exposure to the works of talented people on the Fediverse made me wonder about scribbling in pixels.&lt;&#x2F;p&gt;
&lt;p&gt;What if I tried crafting pixels by hand too?
What could go wrong? (&lt;em&gt;Everything can go wrong, I have no time for doing this!&lt;&#x2F;em&gt;, says a side of my mind I choose to blatantly ignore).&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>Emacs Feed Configuration</title>
            <pubDate>Mon, 13 Mar 2023 21:48:00 +0100</pubDate>
            <link>https://digressions.zwit.link/en/software/emacs-config-feed/</link>
            <guid>https://digressions.zwit.link/en/software/emacs-config-feed/</guid>
            <description>&lt;p&gt;People continuously write a viscous, non-local, scattered gargantuan text just by existing on the internet.
Managing how to access this text can be tricky since we need to filter out the noise and focus on the content we need or are curious about. When it comes to text, Emacs is usually well-equipped to improve our life. As we will discover soon in this post, this case makes no exception.&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>Start Qute Now</title>
            <pubDate>Fri, 09 Dec 2022 17:18:00 +0100</pubDate>
            <link>https://digressions.zwit.link/en/software/start-qute-now/</link>
            <guid>https://digressions.zwit.link/en/software/start-qute-now/</guid>
            <description>&lt;p&gt;A few days ago, I started using Qutebrowser. I mean using it for real. It wasn&#x27;t my first installation: I tried it other times in the past, but I had never considered leaving Firefox. This time I&#x27;m using it as a daily driver, migrating my entire workflow into it.&lt;&#x2F;p&gt;
&lt;p&gt;But why I had this mad idea of leaving Firefox in the first place?&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>Get user inputs in Emacs Lisp</title>
            <pubDate>Sat, 05 Nov 2022 12:42:00 +0100</pubDate>
            <link>https://digressions.zwit.link/en/software/get-user-inputs-in-emacs-lisp/</link>
            <guid>https://digressions.zwit.link/en/software/get-user-inputs-in-emacs-lisp/</guid>
            <description>&lt;p&gt;This post is intended to give beginners an introduction on how to use lisp to manage user&#x27;s inputs on Emacs.&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>Literate plotting of a Lorenz Attractor with Python&#x2F;Org-mode</title>
            <pubDate>Tue, 01 Nov 2022 00:00:00 +0000</pubDate>
            <link>https://digressions.zwit.link/en/software/literate-plotting-of-a-lorenz-attractor-with-python-org-mode/</link>
            <guid>https://digressions.zwit.link/en/software/literate-plotting-of-a-lorenz-attractor-with-python-org-mode/</guid>
            <description>&lt;p&gt;Let&#x27;s explore the shape of the Lorenz attractor with Python in Org mode&#x2F;Emacs. Because why not.&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>Check-list for Lo-fi listeners</title>
            <pubDate>Mon, 28 Mar 2022 00:00:00 +0000</pubDate>
            <link>https://digressions.zwit.link/en/2022/check-list-for-lofi-listeners/</link>
            <guid>https://digressions.zwit.link/en/2022/check-list-for-lofi-listeners/</guid>
            <description>&lt;p&gt;For everyone who is studying with this song, a check-list:&lt;&#x2F;p&gt;
</description>
        </item>
        <item>
            <title>How do I M-x play my Lo-fi music</title>
            <pubDate>Sat, 12 Mar 2022 00:00:00 +0000</pubDate>
            <link>https://digressions.zwit.link/en/software/how-do-i-play-my-lofi-music/</link>
            <guid>https://digressions.zwit.link/en/software/how-do-i-play-my-lofi-music/</guid>
            <description>&lt;p&gt;Once upon a time, a guy was trying to start his study session right away, so, without further hesitations, he put on his headset and started YouTube to play some good Lo-fi music. But something didn&#x27;t go well and the same guy got lost on the web for over an hour. Probably, bright minds already imagined it, but that guy was me, and that&#x27;s the story of how I managed to avoid that something similar could happen to me ever again.&lt;&#x2F;p&gt;
&lt;p&gt;The first solution was absolutely simple and effective:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; style=&quot;background-color:#1d1f21;color:#c5c8c6;&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span style=&quot;color:#999999;&quot;&gt;# ~&#x2F;.bashrc or ~&#x2F;.bash_aliases (if configured)
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#81a2be;&quot;&gt;alias lofi&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8abeb7;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color:#7ec699;&quot;&gt;&amp;quot;python -mwebbrowser https:&#x2F;&#x2F;youtube.com&#x2F;watch?v=8nXqcugV2Y4&amp;quot;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Proudly, I was sipping tea at ~ 3:00 AM.&lt;&#x2F;p&gt;
&lt;video muted autoplay loop style=&quot;width: 100%&quot;&gt;
  &lt;source src=giphy-tea.mp4 type=&quot;video&#x2F;mp4&quot;&gt;
  Your browser does not support the video tag.
&lt;&#x2F;video&gt;
&lt;p&gt;
  &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;giphy.com&amp;#x2F;gifs&amp;#x2F;tea-kermit-the-frog-sipping-3o85xGocUH8RYoDKKs&quot;&gt;via GIPHY&lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;
&lt;p&gt;Of course, the previous one was a pretty limited solution: the alias opens the same link over and over: you cannot feel the thrill of discovery. I said to myself that I needed to add some chaos to the logic, maybe a list of links to a bunch of YT radios.&lt;&#x2F;p&gt;
&lt;p&gt;We have &lt;strong&gt;a lot&lt;&#x2F;strong&gt; of ways to achieve this result. I will cite the first two that bumps in my head:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The Python way: a little script in Python which could hold both the logic and the list of links;&lt;&#x2F;li&gt;
&lt;li&gt;The Bash way: maintaining a dotfile like &lt;code&gt;.lofi-links&lt;&#x2F;code&gt; from which a bash function could peak a different line every time.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The second option seemed the cleanest to be, because it keeps on different files the data and the logic, but I don&#x27;t love scripting in bash to be honest, because I feel it&#x27;s poorly readable and &lt;strong&gt;bash functions are always more complex than you should say at first&lt;&#x2F;strong&gt;. Of course, complexity is not &amp;quot;bad&amp;quot;, no one would say that, but (of course) it depends on the situation, and I didn&#x27;t want extra-complexity for a simple task: quite the opposite, I wanted a simple and easily maintainable script and setting it fastly in every machine I have and will have in the years. I could easily find myself making changes or extensions of some kind, so I don&#x27;t want to read the docs of every function every single time.&lt;&#x2F;p&gt;
&lt;p&gt;In the end, my mind took the radical path: &lt;strong&gt;why not Emacs Lisp?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;the-emacs-way&quot;&gt;The Emacs way&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-emacs-way&quot; aria-label=&quot;Anchor link for: the-emacs-way&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;This paragraph aims to teach some basic lisp trick to other lisp beginners. Let&#x27;s get into action, shall we?&lt;&#x2F;p&gt;
&lt;p&gt;First of all, we &lt;a href=&quot;https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;emacs&#x2F;manual&#x2F;html_node&#x2F;elisp&#x2F;Setting-Variables.html&quot;&gt;set a variable&lt;&#x2F;a&gt; with a list of our links of choice. This is mine: &lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;lisp&quot; style=&quot;background-color:#1d1f21;color:#c5c8c6;&quot; class=&quot;language-lisp &quot;&gt;&lt;code class=&quot;language-lisp&quot; data-lang=&quot;lisp&quot;&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#81a2be;&quot;&gt;setq&lt;&#x2F;span&gt;&lt;span&gt; links &amp;#39;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#7ec699;&quot;&gt;&amp;quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=8nXqcugV2Y4&amp;quot; 
&lt;&#x2F;span&gt;&lt;span&gt;                &lt;&#x2F;span&gt;&lt;span style=&quot;color:#7ec699;&quot;&gt;&amp;quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=FVue6P2VoTc&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt;                &lt;&#x2F;span&gt;&lt;span style=&quot;color:#7ec699;&quot;&gt;&amp;quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=kgx4WGK0oNU&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt;                &lt;&#x2F;span&gt;&lt;span style=&quot;color:#7ec699;&quot;&gt;&amp;quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=5qap5aO4i9A&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;))
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then, we should find a way to randomize the choice of the link by shuffling the list, just like with a card deck:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;lisp&quot; style=&quot;background-color:#1d1f21;color:#c5c8c6;&quot; class=&quot;language-lisp &quot;&gt;&lt;code class=&quot;language-lisp&quot; data-lang=&quot;lisp&quot;&gt;&lt;span style=&quot;color:#999999;&quot;&gt;;; Implementation of the knuth shuffle
&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#cc99cd;&quot;&gt;defun &lt;&#x2F;span&gt;&lt;span style=&quot;color:#81a2be;&quot;&gt;nshuffle &lt;&#x2F;span&gt;&lt;span&gt;(sequence)
&lt;&#x2F;span&gt;&lt;span&gt;  (cl&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8abeb7;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color:#cc99cd;&quot;&gt;loop for&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color:#cc99cd;&quot;&gt;from &lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#81a2be;&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt; sequence) downto &lt;&#x2F;span&gt;&lt;span style=&quot;color:#f08d49;&quot;&gt;2
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#cc99cd;&quot;&gt;do &lt;&#x2F;span&gt;&lt;span&gt;(cl&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8abeb7;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color:#81a2be;&quot;&gt;rotatef &lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#81a2be;&quot;&gt;elt&lt;&#x2F;span&gt;&lt;span&gt; sequence (&lt;&#x2F;span&gt;&lt;span style=&quot;color:#81a2be;&quot;&gt;random&lt;&#x2F;span&gt;&lt;span&gt; i))
&lt;&#x2F;span&gt;&lt;span&gt;                    (&lt;&#x2F;span&gt;&lt;span style=&quot;color:#81a2be;&quot;&gt;elt&lt;&#x2F;span&gt;&lt;span&gt; sequence (&lt;&#x2F;span&gt;&lt;span style=&quot;color:#f08d49;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8abeb7;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; i))))
&lt;&#x2F;span&gt;&lt;span&gt;  sequence)
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;49505968&#x2F;13436102&quot;&gt;This is the source of the function&lt;&#x2F;a&gt;, I just edited it in order to &lt;a href=&quot;https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;30847443&#x2F;emacs-symbols-function-definition-is-void-loop&quot;&gt;express explicitly the use of Common Lisp functions&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In the end, we write the core function, which works launching a command on the shell, like in the first deadly simple solution. This time, the link passed to the command is the first one of the shuffled list of links we made with the previous function.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;lisp&quot; style=&quot;background-color:#1d1f21;color:#c5c8c6;&quot; class=&quot;language-lisp &quot;&gt;&lt;code class=&quot;language-lisp&quot; data-lang=&quot;lisp&quot;&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#cc99cd;&quot;&gt;defun &lt;&#x2F;span&gt;&lt;span style=&quot;color:#81a2be;&quot;&gt;play-lofi &lt;&#x2F;span&gt;&lt;span&gt;()
&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;span style=&quot;color:#7ec699;&quot;&gt;&amp;quot;Play random lofi music on your browser&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt;  (interactive)
&lt;&#x2F;span&gt;&lt;span&gt;  (shell&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8abeb7;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;command (concat &lt;&#x2F;span&gt;&lt;span style=&quot;color:#7ec699;&quot;&gt;&amp;quot;python -mwebbrowser &amp;quot; &lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#81a2be;&quot;&gt;car &lt;&#x2F;span&gt;&lt;span&gt;(nshuffle links)))))
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In order to evoke this function from within the editor, we defined it as &lt;code&gt;interactive&lt;&#x2F;code&gt; in the second line. This means we can simply &lt;code&gt;Alt+x play-lofi&lt;&#x2F;code&gt; to run our music. We could even add a shortcut at this point and remove the need to call python from the shell, but I have not so much time right now, so I will keep it like this for the moment: it&#x27;s really unlikely that I will ever use a machine without Python pre-installed in the future and so do you, I guess.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Wait, but are we forced to launch the command from an Emacs instance every time?&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;If you&#x27;re one of those weirdos who want to leave Emacs and this looks like a downside for you, I stop you right there.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;back-to-the-cli&quot;&gt;Back to the CLI&lt;a class=&quot;zola-anchor&quot; href=&quot;#back-to-the-cli&quot; aria-label=&quot;Anchor link for: back-to-the-cli&quot;&gt;§&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;Considering that Emacs is always alive in the &lt;a href=&quot;https:&#x2F;&#x2F;www.emacswiki.org&#x2F;emacs&#x2F;EmacsAsDaemon&quot;&gt;Daemon mode&lt;&#x2F;a&gt; and I limit myself to spawning clients wherever needed, this means that we can call function from terminal too without opening any window.&lt;&#x2F;p&gt;
&lt;p&gt;Practically, we can solve this by a simple reformulation of the alias:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; style=&quot;background-color:#1d1f21;color:#c5c8c6;&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span style=&quot;color:#999999;&quot;&gt;# ~&#x2F;.bashrc or ~&#x2F;.bash_aliases (if configured)
&lt;&#x2F;span&gt;&lt;span style=&quot;color:#81a2be;&quot;&gt;alias lofi&lt;&#x2F;span&gt;&lt;span style=&quot;color:#8abeb7;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color:#7ec699;&quot;&gt;&amp;quot;emacsclient -e \(play-lofi\)&amp;quot;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In order to play your music from the terminal emulator, just like we did initially, it&#x27;s sufficient to launch this command.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; style=&quot;background-color:#1d1f21;color:#c5c8c6;&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span style=&quot;color:#cc6666;&quot;&gt;lofi
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Now, please look at your mighty browser running the perfect Lo-fi music or whatever you put in there and enjoy.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;Head Artwork by jisung_clouds -&amp;gt; &lt;a href=&quot;https:&#x2F;&#x2F;www.wattpad.com&#x2F;951465524-father%27s-day-%E2%9E%B3-beomryu-%E2%9C%93-eleven&quot;&gt;https:&#x2F;&#x2F;www.wattpad.com&#x2F;...&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
</description>
        </item>
    </channel>
</rss>
